package cc.edge2.sns.models;

import java.io.Serializable;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.google.appengine.api.users.User;

@PersistenceCapable(identityType = IdentityType.APPLICATION, detachable="true")
public class SNSUser implements Serializable {
	
    @PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    private Long userId;
    @Persistent
    private String name;
    @Persistent
    private String email;
	@Persistent
    private User googleAccount;
	@Persistent
	private String thumbnailUrl = "/img/defaultImage.png";
	@Persistent
	private String selfIntroduction = "";
	
	public String getSelfIntroduction() {
		if(selfIntroduction == null) {
			return "";
		}
		return selfIntroduction;
	}
	public void setSelfIntroduction(String selfIntroduction) {
		this.selfIntroduction = selfIntroduction;
	}
	public String getThumbnailUrl() {
		return thumbnailUrl;
	}
	public void setThumbnailUrl(String thumbnailUrl) {
		this.thumbnailUrl = thumbnailUrl;
	}
	public Long getUserId() {
		return userId;
	}
	public void setUserId(Long userId) {
		this.userId = userId;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public User getGoogleAccount() {
		return googleAccount;
	}
	public void setGoogleAccount(User googleAccount) {
		this.googleAccount = googleAccount;
	}
    public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public SNSUser(Long userId, String name, String email, User googleAccount) {
		super();
		this.userId = userId;
		this.name = name;
		this.email = email;
		this.googleAccount = googleAccount;
	}
	public SNSUser(String name, String email, User googleAccount) {
		super();
		this.name = name;
		this.email = email;
		this.googleAccount = googleAccount;
	}
	public SNSUser(String name, String email) {
		super();
		this.name = name;
		this.email = email;
	}
	public SNSUser(User googleAccount) {
		super();
		this.name = googleAccount.getNickname();
		this.email = googleAccount.getEmail();
		this.googleAccount = googleAccount;
	}
	public SNSUser() {
		super();
	}
	
	
}
